package com.jim.servlet;

import java.io.IOException;

import javax.servlet.http.*;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;


@SuppressWarnings("serial")
public class JimSpaceServlet extends HttpServlet {
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		resp.setContentType("text/plain");
		resp.setCharacterEncoding("UTF-8");
		UserService userService = UserServiceFactory.getUserService();
		User user = userService.getCurrentUser();
		resp.getWriter().println("Hello, " +userService.isUserLoggedIn()+" from "+ req.getRemoteAddr()+"!");
		resp.getWriter().println("This is Jim's Space for learning Google AppEngine!");
/*		resp.getWriter().println("<table width='50%'>");
		RSSReader rssReader = RSSReader.getInstance();
		List<Article> articleList = rssReader.getNews(20);
		for (int i = 0; i< articleList.size();i++)
		{
			Article art = articleList.get(i);
			resp.getWriter().println("<tr>");
			resp.getWriter().println("<td><a href='"+art.getLink()+"'>"+art.getTitle()+"</a></td>");
			resp.getWriter().println("</tr>");
		}*/
		
	}
}
